#ifndef _ICLOCK_COMM_H
#define _ICLOCK_COMM_H

#include <platform.h>
//common header
#include "bmp.h"
#include "strlist.h"


/*
 * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
 * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
 * not already defined, then define it here.
 */
#ifndef TEMP_FAILURE_RETRY
/* Used to retry syscalls that can return EINTR. */
#define TEMP_FAILURE_RETRY(exp) ({         \
    typeof (exp) _rc;                      \
    do {                                   \
        _rc = (exp);                       \
    } while (_rc == -1 && errno == EINTR); \
    _rc; })
#endif


#define MaxHeaderLength (4096*2)
#define MaxURLLength	(1024*2)
typedef struct _Req_
{
	int ReqID;
	char Method[8];
	char ContentType[100];
	char URL[MaxURLLength];
	char Cookies[MaxHeaderLength];
	char *Content;
	int ContentSize;
}TReq,*PReq;

int 
	encodeReq(PReq req, char *target);
int 
	decodeReq(const char *reqStr, char *content, PReq req);
PStrList 
	queryStrToList(const char *queryStr);





#endif

//END
